home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
8bitfiles.net/archives
/
archives.tar
/
archives
/
compuserve-file-archive
/
05 Programming
/
CDT128.ARC
/
BYTE╓STRNG.C
next >
Wrap
Text File
|
2019-04-13
|
2KB
|
53 lines
/***********************************************************************/
/***********************************************************************/
/* */
/* ╘HIS PROGRAM IS COPYRIGHT 1986 BY ┴LAN ┘ORINKS. ╔T MAY BE FREELY */
/* DISTRIBUTED FOR NON COMMERCIAL USAGE IF THIS COPYRIGHT NOTICE IS */
/* LEFT INTACT. ├OMMERCIAL USAGE OF THIS PROGRAM IS EXPLICITLY */
/* FORBIDDEN WITHOUT THE WRITTEN PERMISSION OF THE AUTHOR. */
/* */
/***********************************************************************/
/***********************************************************************/
/* CDT VERSION 1.0 PART 6 OF 15 ╩ULY 25, 1986 */
/***** CONVERT ASCII STRING OF BYTES TO HEX VALUES ***/
#INCLUDE <STDIO.H>
#INCLUDE "DBUG.H"
#DEFINE ╘╫╧ñ╬┘┬╠╙ 2 /* NUMBER OF ASCII CHARARCTERS PER BYTE */
VOID
BYTEñSTRNG()
█
AUTO CHAR TSTRNG[3] ; /* TEMPORARY STRING BUFFER */
AUTO INT I, J ; /* INDEXES */
AUTO INT K ; /* LENGTH OF STRING INPUT BY USER */
EXTERN ╒╔╬╘ HATOI() ;
/* TEST FOR EVEN NUMBER OF DIGITS INPUT */
K = STRLEN(╙╘╥╔╬╟(FND)) ;
IF ( (K % 2) != 0 )
█
PRñUSAGE(0) ;
ABORT() ;
▌
TSTRNG[2] = '\0' ;
FOR( I = 0, J = 0 ; I < K ; I += 2, J++ )
█
STRNCPY( TSTRNG, ( ╙╘╥╔╬╟(FND) + I ), ╘╫╧ñ╬┘┬╠╙ ) ;
*(╙╘╥╔╬╟(FND) + J) = (CHAR)HATOI(TSTRNG) ;
▌
*(╙╘╥╔╬╟(FND)+J) = '\0' ; /* SET END OF NEW BYTE STRING */
▌